package com.ekang.admin.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.web.context.request.async.DeferredResult;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * SwaggerConfig
 */
@Configuration
@EnableSwagger2
@Profile("default")
public class SwaggerConfig {
    @Bean
    public Docket Api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .genericModelSubstitutes(DeferredResult.class)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(false)
                .pathMapping("/")
                .select()
                .build()
                .apiInfo(ApiInfo());


    }
    private ApiInfo ApiInfo() {
        ApiInfo apiInfo = new ApiInfo("微信服务接口(v1.0.0)",//大标题
                "微信服务接口",//小标题
                "1.0",//版本
                " terms of service",
                "gcn99.com",//作者
                "goldcn网站链接",//链接显示文字
                "http://www.gcn99.com/dist/view/login.html"//网站链接
        );
        return apiInfo;
    }
}